package com.example.module_house.vm

import androidx.lifecycle.MutableLiveData
import com.example.lib_common.base.BaseViewModel
import com.example.module_house.model.HouseEntity
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
@HiltViewModel
class HouseViewModel @Inject constructor(private val repository: HouseRepository): BaseViewModel() {
    private val houseList by lazy {
        MutableLiveData<List<HouseEntity>>()
    }
    val houseListLiveData get() = houseList
    fun getPatrolList(){
        execute(
            action = repository.getHouseList(),
            onError = {
                houseList.value = null
            },
            onFinish = {
                houseList.value = it.data
            }
        )
    }
}